how to deploy nodeExporter on kubernetes1.19¶
cat node-exporter-ds.yaml
apiVersion: apps/v1 kind: DaemonSet metadata: name: node-exporter labels: app: node-exporter spec: selector: matchLabels: app: node-exporter template: metadata: labels: app: node-exporter annotations: prometheus.io/scrape: "true" prometheus.io/port: "9100" spec: hostPID: true hostIPC: true hostNetwork: true containers: - ports: - containerPort: 9100 protocol: TCP securityContext: privileged: true image: prom/node-exporter args: - --path.procfs - /host/proc - --path.sysfs - /host/sys - --collector.filesystem.ignored-mount-points - '"^/(sys|proc|dev|host|etc)($|/)"' name: node-exporter volumeMounts: - name: dev mountPath: /host/dev - name: proc mountPath: /host/proc - name: sys mountPath: /host/sys - name: rootfs mountPath: /rootfs volumes: - name: proc hostPath: path: /proc - name: dev hostPath: path: /dev - name: sys hostPath: path: /sys - name: rootfs hostPath: path: /cat node_exporter.service
[Unit] Description=Node Exporter Wants=network-online.target After=network-online.target [Service] User=root Group=root Type=simple ExecStart=/usr/bin/node_exporter [Install] WantedBy=multi-user.targetcat prometheus.yaml
- job_name: 'nodes' scrape_interval: 10s static_configs: - targets: ['192.168.0.202:9100'] - targets: ['192.168.0.203:9100'] - targets: ['192.168.0.204:9100'] - targets: ['192.168.0.205:9100'] - targets: ['192.168.0.206:9100'] - targets: ['192.168.0.207:9100']